/*
 * $Id: Configure.java 167 2013-01-29 11:15:57Z vladimirow@mail.ru $
 * $HeadURL: http://ultralog.googlecode.com/svn/ultralog/trunk/src-example/java/Configure.java $
 *
 * This file is a part of ultralog project (http://code.google.com/p/ultralog/).
 * Released under New BSD License.
 */

import java.util.Properties;

import com.google.code.ultralog.BasicLogger;
import com.google.code.ultralog.LoggerManager;
import com.google.code.ultralog.configuration.PropertiesConfigurator;

/**
 * Example that shows how to configure logging.
 *
 * @author Mikhail Vladimirov
 */
public class Configure
{
    /**
     * Entry point of the example.
     *
     * @param args command-line arguments
     */
    public static void main (String[] args)
    {
        Properties properties = new Properties ();

        properties.setProperty ("writer.type", "file");
        properties.setProperty ("writer.fileName", "test.log");
        properties.setProperty ("writer.level", "WARNING");
        properties.setProperty (
            "writer.level.com.google.code.ultralog", "INFO");

        PropertiesConfigurator.configure (properties);

        BasicLogger logger1 = LoggerManager.createLogger (BasicLogger.class);
        BasicLogger logger2 =
            LoggerManager.createLogger (BasicLogger.class, "foo");

        if (logger1.isInfoEnabled ())
            logger1.info ("This will be logged");

        if (logger2.isInfoEnabled ())
            logger2.info ("But this will be not");
    }
}
